<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@page import="java.net.URLEncoder"%><html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>管理中心</title>
<%@ include file="/common/include.jsp"%>
<link href="/summer/template/admin/css/list.css" rel="stylesheet"
	type="text/css" />
	
<style type="text/css">
	.list .pagerBar .updatePriceButton {
	width: 63px;
	height: 29px;
	line-height: 29px;
	float: left;
	margin-left: 6px;
	text-align: center;
	cursor: pointer;
	outline: none;
	border: none;
	background: url(/summer/template/admin/images/list_bg.gif) -90px -30px repeat-x;
	
	.list .pagerBar .updatePriceButton:hover {
	background: url(/summer/template/admin/images/list_bg.gif) -90px -60px repeat-x;
	
	
	
}

	
}

	.list .pagerBar .importButton {
	width: 63px;
	height: 29px;
	line-height: 29px;
	float: left;
	margin-left: 6px;
	text-align: center;
	cursor: pointer;
	outline: none;
	border: none;
	background: url(/summer/template/admin/images/list_bg.gif) -90px -30px repeat-x;
	
	.list .pagerBar .importButton:hover {
	background: url(/summer/template/admin/images/list_bg.gif) -90px -60px repeat-x;
	
	
	
}

	
}
</style>
<script type="text/javascript" src="/summer/template/admin/js/list.js"></script>
<script type="text/javascript">
$().ready( function() {
	
	var $updatePriceButton = $(".list input.updatePriceButton");// 更新价格按钮

	
	//批量更新价格
	$updatePriceButton.click( function() {
		var url = $(this).attr("url");
		var $idsCheckedCheck = $(".list input[name='ids']:checked");
        
		
		if (confirm("您确定要更新价格么？") == true) {

			document.getElementById("listForm").action=url;
			document.getElementById("listForm").submit();
		}
	});

	var $importButton = $(".list input.importButton");// 更新价格按钮

	//批量更新价格
	$importButton.click( function() {
		var url = $(this).attr("url");
		var name = $(this).val();
		if (confirm("您确定要"+name+"么？") == true) {

			document.getElementById("listForm").action=url;
			document.getElementById("listForm").submit();
		}
	});


	   $("#pager11").autocomplete("goods!searchName.action", {   
	        multiple: true,     
	        width:300,     
	        max:50,     
	        multipleSeparator: ' ',   
	        dataType: 'json',     
	        extraParams: {   
	            "goods.name": function(){return $("#pager11").val();}
	        },   
	        
	      //加入对返回的json对象进行解析函数，函数返回一个数组       
	        parse: function(data) {   
	         var rows = [];  
	         for(var i=0; i<data.length; i++){   
	           rows[rows.length] = {   
	             data:data[i].name.replace(/^\s+|\s+$/g,""),   
	             value:data[i].name.replace(/^\s+|\s+$/g,""),   
	             result:data[i].name.replace(/^\s+|\s+$/g,"")   
	             };   
	           }   
	       return rows;   
	          },   
	        formatItem: function(row, i, n) {   
	          return row;         
	       }   
	    });  
});

function openTaoBao(num_iid,id)
{
	$.ajax({
		url: "goods!getTaoBaoGoodsUrl.action?goods.id="+id+"&goods.num_iid="+num_iid,
		type:'get',
		async: false,
		success: function(data,status) {
		openWin(data,"淘宝商品",800,600);
		}
	});
}
</script>

	
<meta name="Author" content="SHOP++ Team" />
<meta name="Copyright" content="SUMMER" />
<link rel="icon" href="favicon.ico" type="image/x-icon" />
</head>
<body class="list">
<div class="body">
<div class="listBar">
<h1><span class="icon">&nbsp;</span>商品列表<span
	class="pageInfo">总记录数: ${pager.totalCount}
(共${pager.pageCount}页)</span></h1>
</div>
<form id="listForm" action="goods!list.action" method="post">
<s:iterator value="pager.searchMap" var="searchMap">
<s:if test="key!='seller_cids'">
  <input type="hidden" name="pager.searchMap['${searchMap.key}']" value="${searchMap.value}">
</s:if>
</s:iterator>
<div class="operateBar"><input type="button" class="addButton"
	onclick="location.href='goods!add.action'" value="添加产品" />
<label>店铺类目</label>
	<select name="pager.searchMap['seller_cids']">
	<option value="">全部</option>
	<s:iterator value='#request.catList' >
	<option value='<s:property value="cid"/>' <s:if test="pager.searchMap['seller_cids']==cid">selected</s:if>  ><s:property value="name"/></option> </s:iterator></select>	
	
	 <label>查找:</label>
<select name="pager.property">
					<option value="name" >
						名称
					</option>
					<option value="pinpai" >
						品牌
					</option>
</select>
<label class="searchText"><input type="text" id="pager11"  style="width:400"
	name="pager.keyword" value="${pager.keyword}" /></label><input type="button"
	id="searchButton" class="searchButton" value="" onclick="submit()" /> <label>每页显示:</label>
<select name="pager.pageSize" id="pageSize">
<option value="5"
		<s:if test="pager.pageSize==5">selected="selected" </s:if>>
	5</option>
	<option value="10"
		<s:if test="pager.pageSize==10">selected="selected" </s:if>>
	10</option>
	<option value="20"
		<s:if test="pager.pageSize==20">selected="selected" </s:if>>
	20</option>
	<option value="50"
		<s:if test="pager.pageSize==50">selected="selected" </s:if>>
	50</option>
	<option value="100"
		<s:if test="pager.pageSize==100">selected="selected" </s:if>>
	100</option>

</select>
		

</div>
<table class="listTable">
	<tr>
		<th class="check"><input type="checkbox" class="allCheck" /></th>
		<th><span class="sort" name="name">宝贝名称</span></th>
		<th><span class="sort" name="price">淘宝</span></th>
		<th><span class="sort" name="new_price">成本</span></th>
		<th><span class="sort" name="tb_url">淘宝</span></th>
		<th><span class="sort" name="shop_url">网店</span></th>
		<th><span class="sort" name="pinpai">品牌型号</span></th>
		<th><span class="sort" name="volume">30天销量</span></th>
		<th><span class="sort" name="hasShowcase">橱窗</span></th>
		<s:iterator value="shopList" var="tt">
			<th><span><s:property value="cnName"/></span></th>
		</s:iterator>
		<th>操作</th>
		<th>手工搜索</th>

	</tr>

	
	<s:iterator value="pager.list" id="goods">
		<tr <s:if test="synch==false"> bgcolor="yellow"</s:if>>
			<td><input type="checkbox" name="ids" value="<s:property value="id" />" /></td>
			<td><s:if test="matchGood==true"><font color="red">■</font></s:if><s:property value="name" /></td>
			<td><s:property value="price" /></td>
			<td>
				<s:iterator value="good" var="">
					<s:if test="is_master==true">
						 <s:if test="[0].price>=[1].price"><FONT color="red"><b></s:if><s:property value="[0].price" /><s:if test="[0]price>=[1]price"></FONT></b></s:if>
					</s:if>
				</s:iterator>
			</td>	
			
			<td>
			<a href="#" onclick="openTaoBao('<s:property value="num_iid" />','<s:property value="id" />')"   ><img  style="width: 55px;height:45px" src="<s:property value='tb_img' />"  /></a></td>
			<td>
			<s:iterator value="good">
				<s:if test="is_master==true">
			<a href="<s:property value="url" /> "  target="_blank" ><img  style="width: 55px;height:45px" src=<s:property value="%{pic_url.split(';')[0]}" />  /></a>
			</s:if>
			</s:iterator>
		
			</td>
			<td><s:property value="pinpai"  />&nbsp;<s:property value="xinghao"  /></td>
			<td><s:property value="volume"  /></td>
			<td><input type="checkbox" name="hasShowcase" <s:if test="hasShowcase==true">checked</s:if> /></td>
			
			
					<s:iterator value="shopList" >
					<td>&nbsp;
					<s:iterator value="good" >
						<s:if test="[1].id==[0].shop.id">
						<a target="_blank"  href="<s:property value="[0].url" />"><s:property value="[0].price" /></a>
						</s:if>
					</s:iterator>
					</td>
			</s:iterator>
			<td>     
			<a href="goods!edit.action?id=<s:property value="id" />&pager.pageNumber=${pager.pageNumber}&pager.property=name&pager.keyword=<s:property value="@java.net.URLEncoder@encode(pager.keyword,'utf-8')"/>
			<s:iterator value="pager.searchMap" var="searchMap">&pager.searchMap['${searchMap.key}']=${searchMap.value}</s:iterator>" title="编辑">[编辑]</a> 
			<s:if test="[0].product_id!=null">
			<a href="price/other_shop_price!searchGoods.action?id=<s:property value="id" />">[同行]</a>
			&nbsp;
			</s:if>
			<s:if test="synch==false">
				<a href="goods!synch.action?id=<s:property value="id" />" title="传输数据到淘宝">[传输]</a>
			</s:if>
			</td>
			<td>
			<td>
		<s:iterator value="shopList" var="tt">
				<a href='<s:property value="searchKey" /><s:property value="@java.net.URLEncoder@encode(pinpai+' '+xinghao,'gb2312')"/>' title="<s:property value='name'/>" target="_blank">[<s:property value="cnName"/>]</a>
		</s:iterator>
			</td>
			
			</td>
		</tr>
	</s:iterator>

</table>
<s:if test="pager.pageSize>0">
				<div class="pagerBar">
					<input type="button" class="deleteButton" url="goods!delete.action" value="删 除" disabled hidefocus="true" />
					<input type="button" class="updatePriceButton" url="goods!updata_price.action" value="价格+5"  hidefocus="true" />
					<input type="button" class="importButton" url="goods!import_goods.action" value="商品同步"  hidefocus="true" />
					<input type="button" class="importButton" url="goods!updateVolume.action" value="更新销量"  hidefocus="true" />
					<input type="button" class="importButton" url="goods!serachUrl.action" value="匹配商品"  hidefocus="true" />
					<input type="button" class="importButton" url="goods!showCaseOpt.action" value="自动橱窗"  hidefocus="true" />
					<input type="button" class="importButton" url="goods!goMatch.action?goods.matchGood=true" value="匹配锁定"  hidefocus="true" />
					<input type="button" class="importButton" url="goods!goMatch.action?goods.matchGood=false" value="匹配解锁"  hidefocus="true" />
					<input type="button" class="importButton" url="goods!delisting.action" value="下架商品"  hidefocus="true" />
					<input type="button" class="importButton" url="goods!listing.action" value="上架商品"  hidefocus="true" />
					<input type="button" class="importButton" url="goods!delisting.action" value="删除无效"  hidefocus="true" />
					<input type="button" class="importButton" url="goods!updateGoodprice.action" value="更新成本价"  hidefocus="true" />
					
					<s:iterator value="shopList" var="tt">
					<input type="button" class="importButton" url="goods!updateGoodprice.action?shopid=<s:property value='id'/>" value="更新<s:property value='cnName'/>价"  hidefocus="true" />
					</s:iterator></div><div>
			<jsp:include page="/jsp/page.jsp"></jsp:include>
				</div>
			</s:if>
			<s:else>
				<div class="noRecord">
					没有找到任何记录!
				</div>
			</s:else>
</form>
</div>
</body>
</html>

